package com.hqd.ch03.v49.context.event;

import com.hqd.ch03.v49.context.ApplicationListener;

import java.lang.reflect.Method;

public interface EventListenerFactory {

    /**
     * Specify if this factory supports the specified {@link Method}.
     *
     * @param method an {@link EventListener} annotated method
     * @return {@code true} if this factory supports the specified method
     */
    boolean supportsMethod(Method method);

    /**
     * Create an {@link ApplicationListener} for the specified method.
     *
     * @param beanName the name of the bean
     * @param type     the target type of the instance
     * @param method   the {@link EventListener} annotated method
     * @return an application listener, suitable to invoke the specified method
     */
    ApplicationListener<?> createApplicationListener(String beanName, Class<?> type, Method method);

}
